import org.apache.commons.mail.EmailException;
import org.apache.commons.mail.SimpleEmail;
/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 石方旭
 * Date: 2022-04-18
 * Time: 17:46
 */
public class TestDemo {
    public static void senEmailTest(String FromEmail,String ToEmail,
                                    String subject,String message) {
        SimpleEmail email = new SimpleEmail();
        //qq：qq邮件服务器的端口号
        email.setSslSmtpPort("465");
        email.setHostName("smtp.qq.com");
        email.setAuthentication("2113452635@qq.com", "bvnwllvvfeomcjeg");
        email.setCharset("UTF-8");
        //1、从文件把所有的qq邮箱读取出来
        //2、存储到一个数据结构当中
        //3、String email = 数据结构当中取一个
        try {
            email.addTo(ToEmail);
            email.setFrom("2113452635@qq.com");
            email.setSubject("2514058904@qq.com");
            email.setMsg("是伟哥么"+"写代码了么？？");
            email.send();
        } catch (EmailException e) {
            e.printStackTrace();
        }
    }
}
